package com.sean.learnelasticsearch.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * 文章实体类
 *
 * @author 林思瀚 (linsihan@cndatacom.com)
 * @date 2023-09-21 10:37:44
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("article")
@Document(indexName = "article_index")
@JsonIgnoreProperties(ignoreUnknown = true)
public class Article extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /** 主键 id */
    @TableId
    @Id
    @Field(type = FieldType.Keyword)
    private Long id;

    /** 文章标题 */
    @Field(type = FieldType.Text)
    private String title;

    /** 文章内容 */
    @Field(type = FieldType.Text)
    private String context;

    /** 点赞数 */
    @Field(type = FieldType.Integer)
    private Integer likeCount;
    
    /** 文章类型 */
    @Field(type = FieldType.Keyword)
    private String type;
}
